﻿namespace AspNetCore.Host.Hosting
{
    public interface IWebHostEnvironment
    {
        string EnvironmentName { get; }
    }

    public class WebHostEnvironment: IWebHostEnvironment
    {
        public string EnvironmentName { get; }

        public WebHostEnvironment(string environmentName)
        {
            EnvironmentName = environmentName;
        }
    }

    public static class IWebHostEnvironmentExtensions
    {
        public static bool IsDevelopment(IWebHostEnvironment environment)
        {
            return environment.EnvironmentName == "Development";
        }

        public static bool IsProduction(IWebHostEnvironment environment)
        {
            return environment.EnvironmentName == "Production";
        }
    }
}
